package com.myblog.service.impl;

import com.myblog.model.po.SysUser;
import com.myblog.service.SysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("CustomUserDetailService")
@Slf4j
public class CustomUserDetailService extends AbstractUserUserDetailService {

    @Autowired
    private SysUserService userService;

    @Override
    public SysUser findSysUser(String usernameOrMobile) {
        log.info("请求认证的用户名是："+usernameOrMobile);
        List<SysUser> list = userService.lambdaQuery().eq(SysUser::getUsername, usernameOrMobile).list();
        return list.get(0);
    }





}
